(* SHIL sortHelper*)
let sortAscHelper inputArr =
	(List.sort compare (Array.to_list inputArr));;
(* SHIL sortHelper*)
let sortDecHelper inputArr =
	(List.rev (List.sort compare (Array.to_list inputArr)));;

(* SHIL sort *)
let sort inputArr ascending =
	if ascending then
		(Array.of_list (sortAscHelper inputArr))
	else (Array.of_list (sortDecHelper inputArr));;
	
(*SHIL randomizeHelper - use as a compare function to randomize sort*)	
let randomizeHelper x y = 
	Random.int 2;;
	
(* SHIL randomize *)
(*Not efficient*)
(*let randomize inputArr =
	(Array.of_list (List.sort randomizeHelper (Array.to_list inputArr)));;
let randomizeHelper x y = 
	Random.int 2;;
*)
(*More efficient*)	
(*
let randomize inputArr =
		let randomizeHelper x y = Random.int 2 in
	(Array.of_list (List.sort randomizeHelper (Array.to_list inputArr)));;
*)
(*Most efficient*)	
let randomize inputArr =
	(Array.of_list (List.sort (fun x y -> Random.int 2) (Array.to_list inputArr)));;
	

(*Used for the getKeys & get Values functions below*)
module StringMap = Map.Make(String);;

(* SHIL getKeys *)
let getKeys inputMap = 
	(Array.of_list (StringMap.fold (fun s n l -> (s)::l ) inputMap []));;
	
(* SHIL getValues*)
let getValues inputMap = 
	(Array.of_list (StringMap.fold (fun s n l -> (n)::l ) inputMap []));;	
	
(* SHIL length*)
let length inputArr =
	(Array.length inputArr);;

(* SHIL aggregate*)
let aggregate inputArr inputFunct initVal =
	(Array.fold_left inputFunct initVal inputArr);;

(* SHIL modify*)
let modify inputArr inputFunct =
	(Array.map inputFunct inputArr);;	
	
	
	